home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Tele
/
Pete Johnson
/
mehit 3.0.b15<source>.cpt
/
mehit dialogs.p
< prev
next >
Wrap
Text File
|
1991-07-07
|
42KB
|
1,437 lines
unit mehitDialogs;
interface
uses
Globals, mehitFile, Help, HelloTabby, Backup, FileAndStuffIt;
var
Changed: boolean; { Did we change a setting? }
procedure ConfigureDialog;
procedure GlobalDialog (var AString: STR255);
procedure GetHelp (RefNum: integer);
implementation
{----------------------------------------------------------------- }
function ButtonSelected (whichDialog: DialogPtr; whichItem: integer): boolean;
var
whichType: integer;
whichHandle: handle;
whichRect, displayRect: rect;
mouseLoc: point;
DelayTime: longint;
nowInverted: boolean;
begin
getDItem(whichDialog, whichItem, whichType, whichHandle, whichRect);
displayRect := whichRect;
InsetRect(displayRect, 1, 1);
InvertRect(displayRect);
nowInverted := true;
if StillDown then
repeat
GetMouse(mouseLoc);
if PtInRect(mouseLoc, whichRect) then
begin
if not nowInverted then
begin
InvertRect(displayRect);
nowInverted := true
end
end
else
begin
if nowInverted then
begin
InvertRect(displayRect);
nowInverted := false
end
end
until not StillDown;
if nowInverted then
begin
Delay(4, DelayTime);
InvertRect(displayRect)
end;
ButtonSelected := nowInverted
end;
{----------------------------------------------------------------- }
function GetTheNumber (dialog: DialogPtr; number: integer): integer;
{strips non-numeric characters out of string and returns item value}
var
i: integer;
aLong: longint;
aString, itemString: str255;
iType: integer;
iHandle: handle;
iBox: rect;
begin
GetDItem(dialog, number, iType, iHandle, iBox);
GetIText(iHandle, itemString);
aString := '';
for i := 1 to length(itemString) do
if itemString[i] in ['0'..'9'] then
aString := concat(aString, itemString[i]);
StringToNum(aString, aLong);
GetTheNumber := aLong
end;
{----------------------------------------------------------------- }
procedure ToggleItem (theDialog: DialogPtr; DItem: integer);
var
iType: integer;
iHandle: handle;
iBox: rect;
begin
getDItem(theDialog, DItem, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0)
end;
{----------------------------------------------------------------- }
procedure GetHelp; {(RefNum: integer);}
var
where: point;
theDialog: DialogPtr;
HelpItem, HelpRef: integer;
begin
InitCursor;
HelpRef := OpenResFile('mehit help');
if HelpRef = -1 then { no help file }
begin
theDialog := GetNewDialog(1004, nil, Pointer(-1));
SetPort(theDialog);
FrameDItem(theDialog, OK);
repeat
ModalDialog(nil, HelpItem);
until (HelpItem = 1);
DisposDialog(theDialog);
end { HelpRef = -1 }
else
begin
Help(RefNum, RefNum);
CloseResFile(HelpRef);
end;
end; { procedure GetHelp}
{----------------------------------------------------------------- }
procedure ConfigureDialog;
var
ConfigDialog, StuffItDialog: DialogPtr;
DItem, BuffItem, iType: integer;
iHandle: Handle;
iBox, EField1, EField2, EField3, EField4, EField5: rect;
Finished, Cancel: boolean;
AString, PathName: STR255;
Counter: integer;
where: point;
BuffDone: boolean;
tempDefaultPtr: DefaultStuffPtr;
function DoStuffItDialog (var stuffMode: integer): boolean;
var
stuffitItem, stuffCount: integer;
stuffHandle: Handle;
stuffVersString: str255;
tempLong: longint;
currentPort: GrafPtr;
begin
GetPort(currentPort);
if StuffItExists | FindStuffIt then {FindStuffIt verifies StuffIt & sets StuffItExists true}
begin
CloseStuffIt;
StuffItDialog := GetNewDialog(1010, nil, Pointer(-1));
SetPort(StuffItDialog);
FrameDItem(StuffItDialog, Ok);
for StuffCount := 2 to 7 do
begin
getDItem(StuffItDialog, StuffCount, iType, stuffHandle, iBox);
SetCtlValue(ControlHandle(stuffHandle), 0);
end;
getDItem(StuffItDialog, stuffMode + 2, iType, stuffHandle, iBox);
SetCtlValue(ControlHandle(stuffHandle), 1);
getDItem(StuffItDialog, 9, iType, stuffHandle, iBox);
SetIText(stuffHandle, StuffItVersion);
stuffVersString := copy(StuffItVersion, 1, pos('.', StuffItVersion));
StringToNum(stuffVersString, tempLong);
if (tempLong < 2) then
begin
getDItem(StuffItDialog, ord(StuffNone) + 2, iType, stuffHandle, iBox);
HiliteControl(ControlHandle(stuffHandle), 255);
getDItem(StuffItDialog, ord(StuffNone) + 2, iType, stuffHandle, iBox);
HiliteControl(ControlHandle(stuffHandle), 255);
end;
repeat
ModalDialog(nil, StuffItItem);
case StuffItItem of
2..7:
for stuffCount := 2 to 7 do
begin
getDItem(StuffItDialog, stuffCount, iType, stuffHandle, iBox);
if stuffCount <> StuffItItem then
SetCtlValue(ControlHandle(stuffHandle), 0)
else
SetCtlValue(ControlHandle(stuffHandle), 1)
end;
otherwise
;
end
until StuffItItem = OK;
for stuffCount := 2 to 7 do
begin
getDItem(StuffItDialog, stuffCount, iType, stuffHandle, iBox);
if GetCtlValue(ControlHandle(stuffHandle)) = 1 then
begin
stuffMode := stuffCount - 2;
leave
end
end;
DisposDialog(StuffItDialog);
DoStuffItDialog := true;
end
else
begin {couldn't find stuffit}
StuffItDialog := GetNewDialog(1011, nil, Pointer(-1));
SetPort(StuffItDialog);
FrameDItem(StuffItDialog, Ok);
repeat
ModalDialog(nil, StuffItItem);
until StuffItItem = OK;
DisposDialog(StuffItDialog);
DoStuffItDialog := false
end;
SetPort(currentPort)
end;
{ ------------------------------------------------------ }
procedure UpdateLogStuff;
{ Format for Text Defaults STR 517 is as follows: }
{ 1: Reset CallerLog? (Y/N) }
{ 2: Keep CallerLog for Days/Month? (D/M) }
{ 3: Stuff CallerLog? (N, 1..5) }
{ 4: Reset Tabby Log? (Y/N) }
{ 5: Keep Tabby Log for Days/Month? (D/M) }
{ 6: Stuff Tabby Log? (N, 1..5) }
{ after these 6 bytes, remainder of string consists of 4 }
{ numeric values with the folowing separators: }
{ YM3MY3•1•10•1•10 }
{ 1 2 3 4 }
{ 1: CL days }
{ 2: CLA days }
{ 3: TL days }
{ 4: TLA days }
var
AString: str255;
begin
AString := 'YD2YD2';
with tempDefaultPtr^ do
begin
if not ResetCL then
AString[1] := 'N';
if not DoCLADays then
AString[2] := 'M';
if DoCLAStuff = NoStuff then
AString[3] := 'N'
else
AString[3] := stringOf(ord(DoCLAStuff) : 1);
if not ResetTL then
AString[4] := 'N';
if not DoTLADays then
AString[5] := 'M';
if DoTLAStuff = NoStuff then
AString[6] := 'N'
else
AString[6] := stringOf(ord(DoTLAStuff) : 1);
AString := concat(AString, BULLET, StringOf(CLDays : 1));
AString := concat(AString, BULLET, StringOf(CLADays : 1));
AString := concat(AString, BULLET, StringOf(TLDays : 1));
AString := concat(AString, BULLET, StringOf(TLADays : 1));
RmveResource(GetResource('STR ', 517));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(AString)), 'STR ', 517, 'text defaults')
end; { with tempDefaultPtr^ do }
RmveResource(GetResource('STR ', 510));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(BigLogName)), 'STR ', 510, 'big log name');
RmveResource(GetResource('STR ', 511));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(BriefLogName)), 'STR ', 511, 'brief log name');
RmveResource(GetResource('STR ', 512));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(MsgErrLogName)), 'STR ', 512, 'msg error log name');
RmveResource(GetResource('STR ', 513));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(OrphanLogName)), 'STR ', 513, 'orphan log name');
RmveResource(GetResource('STR ', 514));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(Separator)), 'STR ', 514, 'separator')
end;
{ ------------------------------------------------------ }
procedure UpdateUserStuff;
var
AString: str255;
{ Format for User Defaults STR 516 is as follows: }
{ 1: Process UserLog? (Y/N) }
{ 2: Delete level? (Y/N) }
{ 3: Sort UserLog? (Y/N) }
{ 4: Skip deletes? (Y/N) }
{ 5: Zero user minutes? (Y/N) }
{ 6: Change level? (Y/N) }
{ 7: Kill inactive? (Y/N) }
{ 8: Log deletes? (Y/N) }
{ 9: One-call limit? (Y/N) }
{ 10: Use veteran flag? (Y/N) }
{ 11: Set (or clear)? (Y/N) }
{ after these 11 bytes, remainder of string consists of 9 }
{ numeric values with the folowing separators: }
{ YYYYYYYYYYY•0•0•0•0•0•0•0•0•0 }
{ 1 2 3 4 5 6 7 8 9 }
{ 1: Delete level }
{ 2: Check level }
{ 3: Change level }
{ 4: Change to level }
{ 5: Change to minutes }
{ 6: Inactive days }
{ 7: One-call days }
{ 8; Veteran calls }
{ 9: Flag to set/clear }
begin
AString := 'YYYYYYYYYYY';
with tempDefaultPtr^ do
begin
if ProcessUL = false then
AString[1] := 'N';
if DeleteByLevel = false then
AString[2] := 'N';
if SortUserLog = false then
AString[3] := 'N';
if SkipDeletes = false then
AString[4] := 'N';
if ZeroMin = false then
AString[5] := 'N';
if DoChangeLevel = false then
AString[6] := 'N';
if KillOld = false then
AString[7] := 'N';
if LogDeletes = false then
AString[8] := 'N';
if KillOldOneCalls = false then
AString[9] := 'N';
if UseVetFlag = false then
AString[10] := 'N';
if SetVetFlag = false then
AString[11] := 'N';
AString := concat(AString, BULLET, StringOf(DeleteLevel : 1));
AString := concat(AString, BULLET, StringOf(CheckLevel : 1));
AString := concat(AString, BULLET, StringOf(ChangeLevel : 1));
AString := concat(AString, BULLET, StringOf(ChangeToLevel : 1));
AString := concat(AString, BULLET, StringOf(ChangeToMin : 1));
AString := concat(AString, BULLET, StringOf(InactiveDays : 1));
AString := concat(AString, BULLET, StringOf(OneCallDays : 1));
AString := concat(AString, BULLET, StringOf(VetCalls : 1));
AString := concat(AString, BULLET, StringOf(VetFlag : 1));
RmveResource(GetResource('STR ', 516));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(AString)), 'STR ', 516, 'user defaults');
RmveResource(GetResource('STR ', 515));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(TextType)), 'STR ', 515, 'text type');
end; { with tempDefaultPtr^ do }
end;
{----------------------------------------------------------------- }
procedure ConfigTextArchives;
const
CancelButton = 2;
HelpButton = 4;
ResetCLButton = 5;
CLDaysField = 6;
KeepCLAButton = 7;
MonthlyCLAButton = 8;
CLADaysField = 9;
StuffCLAButton = 10;
ResetTLButton = 11;
TLDaysField = 12;
KeepTLAButton = 13;
MonthlyTLAButton = 14;
TLADaysField = 15;
StuffTLAButton = 16;
CTxtDlog = 1013;
var
CTxtDialog: DialogPtr;
CTxtItem, stuffTemp: integer;
aBox: rect;
tempString: str255;
begin
{ Format for Text Defaults STR 517 is as follows: }
{ 1: Reset CallerLog? (Y/N) }
{ 2: Keep CallerLog for Days/Month? (D/M) }
{ 3: Stuff CallerLog? (N, 1..5) }
{ 4: Reset Tabby Log? (Y/N) }
{ 5: Keep Tabby Log for Days/Month? (D/M) }
{ 6: Stuff Tabby Log? (N, 1..5) }
{ after these 6 bytes, remainder of string consists of 4 }
{ numeric values with the folowing separators: }
{ YY3YY3•1•10•1•10 }
{ 1 2 3 4 }
{ 1: CL days }
{ 2: CLA days }
{ 3: TL days }
{ 4: TLA days }
CTxtDialog := GetNewDialog(CTxtDlog, nil, Pointer(-1));
SetPort(CTxtDialog);
FrameDItem(CTxtDialog, Ok);
with tempDefaultPtr^ do
begin
getDItem(CTxtDialog, CLDaysField, iType, iHandle, aBox);
SetIText(iHandle, StringOf(CLDays : 1));
getDItem(CTxtDialog, CLADaysField, iType, iHandle, aBox);
SetIText(iHandle, StringOf(CLADays : 1));
getDItem(CTxtDialog, TLDaysField, iType, iHandle, aBox);
SetIText(iHandle, StringOf(TLDays : 1));
getDItem(CTxtDialog, TLADaysField, iType, iHandle, aBox);
SetIText(iHandle, StringOf(TLADays : 1));
getDItem(CTxtDialog, ResetCLButton, iType, iHandle, aBox);
if ResetCL then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(CTxtDialog, KeepCLAButton, iType, iHandle, aBox);
if DoCLADays then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(CTxtDialog, MonthlyCLAButton, iType, iHandle, aBox);
SetCtlValue(ControlHandle(iHandle), 0);
end
else
begin
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(CTxtDialog, MonthlyCLAButton, iType, iHandle, aBox);
SetCtlValue(ControlHandle(iHandle), 1);
end;
getDItem(CTxtDialog, ResetTLButton, iType, iHandle, aBox);
if ResetTL then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(CTxtDialog, KeepTLAButton, iType, iHandle, aBox);
if DoTLADays then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(CTxtDialog, MonthlyTLAButton, iType, iHandle, aBox);
SetCtlValue(ControlHandle(iHandle), 0);
end
else
begin
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(CTxtDialog, MonthlyTLAButton, iType, iHandle, aBox);
SetCtlValue(ControlHandle(iHandle), 1);
end;
getDItem(CTxtDialog, StuffCLAButton, iType, iHandle, aBox);
if DoCLAStuff <> NoStuff then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(CTxtDialog, StuffTLAButton, iType, iHandle, aBox);
if DoTLAStuff <> NoStuff then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
repeat
ModalDialog(nil, CTxtItem);
case CTxtItem of
Ok:
begin
Finished := true;
CLDays := GetTheNumber(CTxtDialog, CLDaysField);
CLADays := GetTheNumber(CTxtDialog, CLADaysField);
TLDays := GetTheNumber(CTxtDialog, TLDaysField);
TLADays := GetTheNumber(CTxtDialog, TLADaysField);
end;
CancelButton:
Cancel := true;
HelpButton:
begin
GetHelp(258);
SetPort(CTxtDialog);
FrameDItem(CTxtDialog, Ok);
end;
ResetCLButton:
begin
ResetCL := not ResetCL;
ToggleItem(CTxtDialog, ResetCLButton)
end;
KeepCLAButton:
begin
getDItem(CTxtDialog, KeepCLAButton, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(CTxtDialog, MonthlyCLAButton, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
DoCLADays := true
end
else
DoCLADays := false
end;
MonthlyCLAButton:
begin
getDItem(CTxtDialog, MonthlyCLAButton, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(CTxtDialog, KeepCLAButton, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
DoCLADays := false;
end
else
DoCLADays := true
end;
StuffCLAButton:
begin
ToggleItem(CTxtDialog, StuffCLAButton);
getDItem(CTxtDialog, StuffCLAButton, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) <> 0 then
begin
stuffTemp := ord(DoCLAStuff);
if DoStuffItDialog(stuffTemp) then
DoCLAStuff := StuffOpts(stuffTemp)
end
else
begin
SetCtlValue(ControlHandle(iHandle), 0);
DoCLAStuff := NoStuff
end;
FrameDItem(CTxtDialog, Ok)
end;
StuffTLAButton:
begin
ToggleItem(CTxtDialog, StuffTLAButton);
getDItem(CTxtDialog, StuffTLAButton, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) <> 0 then
begin
stuffTemp := ord(DoTLAStuff);
if DoStuffItDialog(stuffTemp) then
DoTLAStuff := StuffOpts(stuffTemp)
end
else
begin
SetCtlValue(ControlHandle(iHandle), 0);
DoTLAStuff := NoStuff
end;
FrameDItem(CTxtDialog, Ok)
end;
ResetTLButton:
begin
ResetTL := not ResetTL;
ToggleItem(CTxtDialog, ResetTLButton)
end;
KeepTLAButton:
begin
getDItem(CTxtDialog, KeepTLAButton, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(CTxtDialog, MonthlyTLAButton, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
DoTLADays := true
end
else
DoTLADays := false
end;
MonthlyTLAButton:
begin
getDItem(CTxtDialog, MonthlyTLAButton, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(CTxtDialog, KeepTLAButton, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
DoTLADays := false;
end
else
DoTLADays := true;
end;
end; {case}
until CTxtItem in [Ok, CancelButton];
end; {with tempDefaultPtr^ do}
DisposDialog(CTxtDialog);
end;
{----------------------------------------------------------------- }
procedure ConfigUserLogDialog;
const
CancelButton = 2;
MoreButton = 3;
HelpButton = 4;
var
ULDialog: DialogPtr;
ULItem: integer;
aBox: rect;
tempString: str255;
{----------------------------------------------------------------- }
begin
ULDialog := GetNewDialog(1012, nil, Pointer(-1));
SetPort(ULDialog);
FrameDItem(ULDialog, Ok);
with tempDefaultPtr^ do
begin
getDItem(ULDialog, 6, iType, iHandle, aBox);
SetIText(iHandle, TextType);
tempString := stringOf(DeleteLevel : 1);
getDItem(ULDialog, 8, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(CheckLevel : 1);
getDItem(ULDialog, 9, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(ChangeLevel : 1);
getDItem(ULDialog, 14, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(ChangeToLevel : 1);
getDItem(ULDialog, 15, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(ChangeToMin : 1);
getDItem(ULDialog, 16, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(ChangeToMin : 1);
getDItem(ULDialog, 16, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(InactiveDays : 1);
getDItem(ULDialog, 18, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(OneCallDays : 1);
getDItem(ULDialog, 21, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(VetCalls : 1);
getDItem(ULDialog, 23, iType, iHandle, aBox);
SetIText(iHandle, tempString);
tempString := stringOf(VetFlag : 1);
getDItem(ULDialog, 26, iType, iHandle, aBox);
SetIText(iHandle, tempString);
getDItem(ULDialog, 5, iType, iHandle, iBox);
if ProcessUL then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 7, iType, iHandle, iBox);
if DeleteByLevel then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 10, iType, iHandle, iBox);
if SortUserLog then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 11, iType, iHandle, iBox);
if SkipDeletes then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 12, iType, iHandle, iBox);
if ZeroMin then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 13, iType, iHandle, iBox);
if DoChangeLevel then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 17, iType, iHandle, iBox);
if KillOld then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 19, iType, iHandle, iBox);
if LogDeletes then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 20, iType, iHandle, iBox);
if KillOldOneCalls then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 22, iType, iHandle, iBox);
if UseVetFlag then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 24, iType, iHandle, iBox);
if SetVetFlag then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(ULDialog, 25, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
end
else
begin
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ULDialog, 25, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 1);
end;
repeat
ModalDialog(nil, ULItem);
case ULItem of
Ok, MoreButton:
begin
getDItem(ULDialog, 5, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
ProcessUL := false
else
ProcessUL := true;
getDItem(ULDialog, 7, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
DeleteByLevel := false
else
DeleteByLevel := true;
getDItem(ULDialog, 10, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
SortUserLog := false
else
SortUserLog := true;
getDItem(ULDialog, 11, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
SkipDeletes := false
else
SkipDeletes := true;
getDItem(ULDialog, 12, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
ZeroMin := false
else
ZeroMin := true;
getDItem(ULDialog, 13, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
DoChangeLevel := false
else
DoChangeLevel := true;
getDItem(ULDialog, 17, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
KillOld := false
else
KillOld := true;
getDItem(ULDialog, 19, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
LogDeletes := false
else
LogDeletes := true;
getDItem(ULDialog, 20, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
KillOldOneCalls := false
else
KillOldOneCalls := true;
getDItem(ULDialog, 22, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
UseVetFlag := false
else
UseVetFlag := true;
getDItem(ULDialog, 24, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
SetVetFlag := false
else
SetVetFlag := true;
GetDItem(ULDialog, 6, iType, iHandle, iBox);
GetIText(iHandle, tempString);
TextType := tempString;
DeleteLevel := GetTheNumber(ULDialog, 8);
CheckLevel := GetTheNumber(ULDialog, 9);
ChangeLevel := GetTheNumber(ULDialog, 14);
ChangeToLevel := GetTheNumber(ULDialog, 15);
ChangeToMin := GetTheNumber(ULDialog, 16);
InactiveDays := GetTheNumber(ULDialog, 18);
OneCallDays := GetTheNumber(ULDialog, 21);
VetCalls := GetTheNumber(ULDialog, 23);
VetFlag := GetTheNumber(ULDialog, 26);
if (ULItem = Ok) then
Finished := true;
end;
CancelButton:
Cancel := true;
HelpButton:
begin
GetHelp(258);
SetPort(ULDialog);
FrameDItem(ULDialog, Ok);
end;
5, 7, 10..13, 17, 19, 20, 22:
begin
getDItem(ULDialog, ULItem, iType, iHandle, iBox);
ToggleItem(ULDialog, ULItem);
end;
24:
begin
getDItem(ULDialog, 24, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(ULDialog, 25, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0)
end
end;
25:
begin
getDItem(ULDialog, 25, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(ULDialog, 24, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0)
end
end;
otherwise
;
end;
until ULItem in [Ok..MoreButton];
DisposDialog(ULDialog);
end;{with tempDefaultPtr^ do}
if ULItem = MoreButton then
ConfigTextArchives
end;
{----------------------------------------------------------------- }
var
whatToFind: SFTypeList;
fileReply: SFReply;
stuffTemp, newItem, stringCount: integer;
newDefaultsDialog: DialogPtr;
tempString: str255;
rezHandle: handle;
begin
tempDefaultPtr := DefaultStuffPtr(NewPtr(sizeOf(DefaultStuff)));
ConfigDialog := GetNewDialog(1007, nil, Pointer(-1));
SetPort(ConfigDialog);
FrameDItem(ConfigDialog, Ok);
tempDefaultPtr^ := DefaultsPtr^;
with tempDefaultPtr^ do
begin
getDItem(ConfigDialog, 4, iType, iHandle, EField1);
SetIText(iHandle, DNextLaunch);
getDItem(ConfigDialog, 6, iType, iHandle, EField2);
SetIText(iHandle, DBackupPath);
getDItem(ConfigDialog, 8, iType, iHandle, EField3);
SetIText(iHandle, DTextPath);
getDItem(ConfigDialog, 22, iType, iHandle, EField4);
SetIText(iHandle, BUTextPath);
getDItem(ConfigDialog, 24, iType, iHandle, EField5);
SetIText(iHandle, MaxBUSize);
{ Format for Defaults string is 'XXXXX', where positions are as follows: }
{ 1: Write to Tabby Log? (Y/N) }
{ 2: Full mehit Log? (Y/N) }
{ 3: Brief mehit Log? (Y/N) }
{ 4: Backup: Normal, Kill after, Purge, Stuff (B/K/P/0..5) }
{ 5: Error Message Log? (Y/N) }
{ 6: Undelete deleted pub messages? (Y/N) }
for Counter := 1 to 3 do
begin
getDItem(ConfigDialog, Counter + 8, iType, iHandle, iBox);
if Defaults[Counter] = 'Y' then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0)
end;
for Counter := 12 to 14 do
begin
getDItem(ConfigDialog, Counter, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
end;
getDItem(ConfigDialog, 29, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
case DBackupMode of
Normal:
begin
getDItem(ConfigDialog, 12, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 1)
end;
Kill:
begin
getDItem(ConfigDialog, 13, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 1)
end;
Purge:
begin
getDItem(ConfigDialog, 14, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 1)
end;
StuffNone..StuffBetter:
begin
getDItem(ConfigDialog, 29, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 1)
end;
otherwise
begin
end; {what???}
end; { Case Defaults }
getDItem(ConfigDialog, 27, iType, iHandle, iBox);
if LogErrors then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 28, iType, iHandle, iBox);
if Undelete then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 31, iType, iHandle, iBox);
if Renumber then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
end; { with tempDefaultPtr^ do }
DrawDialog(ConfigDialog);
Finished := false;
Cancel := false;
repeat
ModalDialog(nil, DItem);
case DItem of
1: { OK }
Finished := true;
2: { Cancel }
Cancel := true;
3: { Select Next Launch }
if ButtonSelected(ConfigDialog, 3) then
begin
where.h := 60;
where.v := 80;
whatToFind[0] := 'APPL';
ParamText('select next launch', '', '', '');
SFPGetFile(where, '', nil, 1, whatToFind, nil, fileReply, 4000, nil);
if fileReply.good then
begin
getDItem(ConfigDialog, 4, iType, iHandle, iBox);
SetIText(iHandle, fileReply.fName);
end;
FrameDItem(ConfigDialog, Ok);
end;
5: { Select Backup Path }
if ButtonSelected(ConfigDialog, 5) then
begin
where.h := 60;
where.v := 80;
SFPPutFile(where, 'select backup location', 'click to select', nil, fileReply, 3999, nil);
if fileReply.good then
begin
Err := Create(fileReply.fname, fileReply.vRefNum, 'QED1', 'TEXT');
MakePath(fileReply.fname, fileReply.vRefNum, PathName);
Err := FSDelete(fileReply.fname, fileReply.vRefNum);
getDItem(ConfigDialog, 6, iType, iHandle, iBox);
SetIText(iHandle, PathName);
end;
FrameDItem(ConfigDialog, Ok);
end;
7: { Select TextFiles Path }
if ButtonSelected(ConfigDialog, 7) then
begin
where.h := 60;
where.v := 80;
SFPPutFile(where, 'select text files location', 'click to select', nil, fileReply, 3999, nil);
if fileReply.good then
begin
Err := Create(fileReply.fname, fileReply.vRefNum, 'QED1', 'TEXT');
MakePath(fileReply.fname, fileReply.vRefNum, PathName);
Err := FSDelete(fileReply.fname, fileReply.vRefNum);
getDItem(ConfigDialog, 8, iType, iHandle, iBox);
SetIText(iHandle, PathName);
end;
FrameDItem(ConfigDialog, Ok);
end;
23: { Select B/U TextFiles Path }
if ButtonSelected(ConfigDialog, 23) then
begin
where.h := 60;
where.v := 80;
SFPPutFile(where, 'select b/u text files location', 'click to select', nil, fileReply, 3999, nil);
if fileReply.good then
begin
Err := Create(fileReply.fname, fileReply.vRefNum, 'QED1', 'TEXT');
MakePath(fileReply.fname, fileReply.vRefNum, PathName);
Err := FSDelete(fileReply.fname, fileReply.vRefNum);
getDItem(ConfigDialog, 22, iType, iHandle, iBox);
SetIText(iHandle, PathName);
end;
FrameDItem(ConfigDialog, Ok);
end;
9, 10, 11, 27, 28, 31:
ToggleItem(ConfigDialog, DItem);
12:
begin
getDItem(ConfigDialog, 12, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(ConfigDialog, 13, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 14, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 29, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
end;
end;
13:
begin
getDItem(ConfigDialog, 13, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(ConfigDialog, 12, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 14, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 29, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
end;
end;
14:
begin
getDItem(ConfigDialog, 14, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 0 then
begin
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(ConfigDialog, 12, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 13, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 29, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
end;
end;
29:
begin
getDItem(ConfigDialog, 29, iType, iHandle, iBox);
stuffTemp := ord(tempDefaultPtr^.DBackupMode) - ord(StuffNone);
if DoStuffItDialog(stuffTemp) then
begin
tempDefaultPtr^.DBackupMode := BackOpts(stuffTemp + ord(StuffNone));
FrameDItem(ConfigDialog, Ok);
SetCtlValue(ControlHandle(iHandle), 1);
getDItem(ConfigDialog, 12, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 13, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0);
getDItem(ConfigDialog, 14, iType, iHandle, iBox);
SetCtlValue(ControlHandle(iHandle), 0)
end;
FrameDItem(ConfigDialog, Ok);
end;
20: { Help Dialog }
begin
GetHelp(258);
SetPort(ConfigDialog);
FrameDItem(ConfigDialog, Ok);
end;
30: { More button }
begin
ConfigUserLogDialog;
if not (Finished | Cancel) then
begin
SetPort(ConfigDialog);
FrameDItem(ConfigDialog, Ok)
end
end;
32: { new defaults Dialog }
begin
newDefaultsDialog := GetNewDialog(1014, nil, Pointer(-1));
SetPort(newDefaultsDialog);
FrameDItem(newDefaultsDialog, Ok);
with tempDefaultPtr^ do
begin
getDItem(newDefaultsDialog, 2, iType, iHandle, iBox);
SetIText(iHandle, stringOf(newLimit : 1));
getDItem(newDefaultsDialog, 3, iType, iHandle, iBox);
SetIText(iHandle, stringOf(newAge : 1));
getDItem(newDefaultsDialog, 4, iType, iHandle, iBox);
if newBU then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
repeat
ModalDialog(nil, newItem);
case newItem of
4:
begin
newBU := not newBU;
getDItem(newDefaultsDialog, 4, iType, iHandle, iBox);
if newBU then
SetCtlValue(ControlHandle(iHandle), 1)
else
SetCtlValue(ControlHandle(iHandle), 0);
end;
otherwise
;
end;{case}
until newItem = Ok;
newLimit := GetTheNumber(newDefaultsDialog, 2);
newAge := GetTheNumber(newDefaultsDialog, 3);
end;{with tempDefaultPtr^}
DisposDialog(newDefaultsDialog);
SetPort(ConfigDialog);
FrameDItem(ConfigDialog, Ok)
end;
otherwise
;
end;
until Finished | Cancel;
if Finished then
with tempDefaultPtr^ do
begin
UseResFile(internalResFile);
GetDItem(ConfigDialog, 4, iType, iHandle, iBox);
GetIText(iHandle, DNextLaunch);
RmveResource(GetResource('STR ', 500));
UpdateResFile(internalResFile);
AddResource(Handle(NewString(DNextLaunch)), 'STR ', 500, 'Next Launch');
UseResFile(externalResFile);
GetDItem(ConfigDialog, 6, iType, iHandle, iBox);
GetIText(iHandle, DBackupPath);
RmveResource(GetResource('STR ', 501));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(DBackupPath)), 'STR ', 501, 'Backup Path:');
GetDItem(ConfigDialog, 8, iType, iHandle, iBox);
GetIText(iHandle, DTextPath);
RmveResource(GetResource('STR ', 502));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(DTextPath)), 'STR ', 502, 'Text Path:');
GetDItem(ConfigDialog, 9, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
WriteToTabby := true;
Defaults[1] := 'Y'
end
else
begin
WriteToTabby := false;
Defaults[1] := 'N'
end;
GetDItem(ConfigDialog, 10, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
FullLog := true;
Defaults[2] := 'Y'
end
else
begin
FullLog := false;
Defaults[2] := 'N'
end;
GetDItem(ConfigDialog, 11, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
BriefLog := true;
Defaults[3] := 'Y'
end
else
begin
BriefLog := false;
Defaults[3] := 'N'
end;
getDItem(ConfigDialog, 12, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
DBackupMode := Normal;
Defaults[4] := 'B';
end
else
begin
getDItem(ConfigDialog, 13, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
DBackupMode := Kill;
Defaults[4] := 'K'
end
else
begin
getDItem(ConfigDialog, 14, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
DBackupMode := Purge;
Defaults[4] := 'P'
end
else
Defaults[4] := StringOf((ord(DBackupMode) - 2) : 1);
end
end;
getDItem(ConfigDialog, 27, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
LogErrors := true;
Defaults[5] := 'Y'
end
else
begin
LogErrors := false;
Defaults[5] := 'N'
end;
getDItem(ConfigDialog, 28, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
Undelete := true;
Defaults[6] := 'Y'
end
else
begin
Undelete := false;
Defaults[6] := 'N'
end;
getDItem(ConfigDialog, 31, iType, iHandle, iBox);
if GetCtlValue(ControlHandle(iHandle)) = 1 then
begin
Renumber := true;
Defaults[7] := 'Y'
end
else
begin
Renumber := false;
Defaults[7] := 'N'
end;
RmveResource(GetResource('STR ', 503));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(Defaults)), 'STR ', 503, 'Defaults');
GetDItem(ConfigDialog, 22, iType, iHandle, iBox);
GetIText(iHandle, BUTextPath);
RmveResource(GetResource('STR ', 504));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(BUTextPath)), 'STR ', 504, 'B/U Text Path:');
GetDItem(ConfigDialog, 24, iType, iHandle, iBox);
GetIText(iHandle, MaxBUSize);
RmveResource(GetResource('STR ', 505));
UpdateResFile(externalResFile);
AddResource(Handle(NewString(MaxBUSize)), 'STR ', 505, 'Max B/U Size');
RmveResource(GetResource('STR ', 518));
UpdateResFile(externalResFile);
tempString := concat(stringOf(newLimit : 1), '•', stringOf(newAge : 1), '•');
if newBU then
tempString := concat(tempString, 'Y')
else
tempString := concat(tempString, 'N');
AddResource(Handle(NewString(tempString)), 'STR ', 518, 'new section settings');
UpdateUserStuff;
UpdateLogStuff;
DefaultsPtr^ := tempDefaultPtr^;
end;
if tempDefaultPtr <> nil then
DisposPtr(POINTER(tempDefaultPtr));
if ConfigDialog <> nil then
DisposDialog(ConfigDialog);
end;
{----------------------------------------------------------------- }
procedure GlobalDialog (var AString: STR255);
var
GlobalDialog: DialogPtr;
DItem, iType: integer;
iHandle: Handle;
iBox: rect;
Finished, Cancel: boolean;
begin
InitCursor;
GlobalDialog := GetNewDialog(1005, nil, Pointer(-1));
SetPort(GlobalDialog);
FrameDItem(GlobalDialog, Ok);
Finished := false;
Cancel := false;
repeat
ModalDialog(nil, DItem);
case DItem of
1: { OK }
begin
Changed := true;
Finished := true;
end;
2: { Cancel }
Cancel := true;
3:
; { Edit field }
end;
until Finished | Cancel;
if not Cancel then
begin
GetDItem(GlobalDialog, 3, iType, iHandle, iBox);
GetIText(iHandle, AString);
end
else
AString := '';
DisposDialog(GlobalDialog);
end;
end.